<template>
  <div id="">
    <h3>欢迎来到管理员系统</h3>
    <div id="main" style="width: 1000px; height: 300px"></div>
  </div>
</template>

<script setup>
import * as echarts from "echarts";
import { onMounted } from "vue";
import axios from "axios";
import { ElMessage } from "element-plus";
import {welcomeOption} from '@/api/options.js'
// import welcomeOption from '@/api/options'

let options = welcomeOption

const initData = async function () {
  const { data: res } = await axios.post("filminfo/getList", {});
  if (res.code != 200) {
    return ElMessage({
      message: res.message,
      type: "error",
    });
  } else {
    var myChart = echarts.init(document.getElementById("main"));

    var temp = res.data.value;
    // let chartData = Array.from(temp,({filmName})=>filmName)
    let chartData = Array.from(temp, (e) => e.filmName);
    console.log("charts", chartData);
    console.log(welcomeOption)
    options.xAxis.data = chartData;
    myChart.setOption(options);
  }
};

</script>

<style>
</style>